'use strict';

const { Controller } = require('egg');

class CsrfController extends Controller {
  index() {
    const { ctx } = this;
    const csrf = ctx.csrf;
    ctx.body = csrf;
    ctx.cookies.set('csrfToken', csrf, {
      sameSite: 'none',
      httpOnly: false,
      signed: false,
    });
  }
}

module.exports = CsrfController;
